package com.sports.common.convertor;

import com.sports.domain.dto.res.FavoritesResDto;
import com.sports.domain.model.FavoritesEntity;
import com.sports.domain.po.FavoritesPo;
import com.baomidou.mybatisplus.ext.IConvertor;
import com.baomidou.mybatisplus.ext.Pager;
import org.mapstruct.Mapper;

@Mapper(componentModel="spring")
public abstract class FavoritesResDtoConvertor implements IConvertor<FavoritesResDto,FavoritesEntity,FavoritesPo> {

    public  Pager<FavoritesResDto> convertPoPager2ResDtoPager(Pager<FavoritesPo> poPager) {
        if (poPager == null) {
            return null;
        }

        Pager<FavoritesResDto> resDtoPager = new Pager();
        resDtoPager.setTotalCount(poPager.getTotalCount());
        resDtoPager.setPageSize(poPager.getPageSize());
        resDtoPager.setTotalPage(poPager.getTotalPage());
        resDtoPager.setCurrentPage(poPager.getCurrentPage());
        resDtoPager.setList(poList2DtoList(poPager.getList()));

        return resDtoPager;
    }
}








